package com.cheyun.netsalev3.view

import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProviders
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.cheyun.netsalev3.R
import com.cheyun.netsalev3.adapter.MyAdapter
import com.cheyun.netsalev3.bean.basedata.Expchar
import com.cheyun.netsalev3.bean.drive.DriveListInfo
import com.cheyun.netsalev3.bean.drive.Experience
import com.cheyun.netsalev3.bean.drive.Experience2
import com.cheyun.netsalev3.bean.records.Reserve
import com.cheyun.netsalev3.databinding.ActivityCarDriveDetails2Binding
import com.cheyun.netsalev3.databinding.ActivityCarDriveDetailsBinding
import com.cheyun.netsalev3.utils.BaseActivity
import com.cheyun.netsalev3.utils.GlideRoundTransform
import com.cheyun.netsalev3.utils.InjectorUtils
import com.cheyun.netsalev3.utils.MySharedPreferences
import com.cheyun.netsalev3.viewmodel.CarDriveDetailsActivity2ViewModel
import com.cheyun.netsalev3.viewmodel.CarDriveDetailsActivityViewModel

class CarDriveDetailsActivity2 : BaseActivity<ActivityCarDriveDetails2Binding>() {
    override fun initContentView(): Int {
        return R.layout.activity_car_drive_details2
    }


    override fun initViewModel(): ViewModel? {


        var id =intent.getIntExtra("id",0)


        var factory = InjectorUtils.getCarDriveDetailsActivity2ViewModelFactory(id!!)
        return ViewModelProviders.of(this, factory).get(CarDriveDetailsActivity2ViewModel::class.java)
    }

    override fun initData() {
//        binding.ivAgreement
        binding.viewModel?.img?.observe(this, Observer { it ->
            Glide.with(this)
                    .load(it)
                    .transform(GlideRoundTransform(this, 4))
                    .placeholder(R.drawable.datuchicun)
                    .error(R.drawable.datuchicun)
                    .into(binding.ivImg)
        })

    }

    override fun initView() {
//        adapter = MyAdapter(R.layout.expchar_item2, binding.viewModel)
//        var recyclerView = binding.root.findViewById<RecyclerView>(R.id.swipe_target)
//        recyclerView.adapter = adapter
    }

}
